<template>
	<view class="wx-auth-container">
		<view class="logo-info"><image src="../../static/login/login_icon.png" mode=""></image></view>
		<view class="small-tips"><text>Welcome Log in</text></view>
		<button type="primary" class="btn-auth" withCredentials="true" lang="zh_CN" @click="wxLogingetUserinfor"><text>微信快捷登录</text></button>
		<view class="copy_write">
			<checkbox-group @change="checkbtn">
				<label>
					<checkbox value="" :checked="checkStatus" class="check_box"/><text>已阅读并同意<text class="userAgree" @click.stop="userAgree">用户协议，</text>若您的手机号未注册，将为您直接注册账号。</text>
				</label>
			</checkbox-group>
			
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			checkStatus:false,
		};
	},
	methods: {
		checkbtn(e){
			this.checkStatus = !this.checkStatus
			console.log(this.checkStatus)
		},
		userAgree(){
			uni.navigateTo({
				url: '/pages/editor/userAgree'
			})
		},
		wxLogingetUserinfor() {
			let that = this;
			uni.getProvider({
				service: 'oauth',
				success: res => {
					if (~res.provider.indexOf('weixin')) {
						uni.login({
							provider: 'weixin',
							success: res2 => {}
						});
					}
				}
			});
			that.getUserinfor();
		},
		getUserinfor() {
			uni.getUserProfile({
				desc: 'Wexin',
				success: res => {
					uni.setStorage({
						key: 'userInfo',
						data: res.userInfo,
						success: () => {
							uni.navigateBack({
								delta: 1
							});
						}
					});
				}
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.logo-info {
	width: 408rpx;
	height: 408rpx;
	margin-top: 26rpx;
	margin-bottom: 38rpx;
	margin: 0 auto;
	image {
		width: 100%;
		height: 100%;
	}
}
.small-tips {
	text-align: center;
	margin-bottom: 40rpx;
	text {
		font-family: PingFangSC-Medium;
		font-size: 42rpx;
		color: #333333;
		letter-spacing: 0;
		text-align: center;
		font-weight: 500;
	}
}
.btn-auth {
	width: 92% !important;
	text {
		font-size: 32rpx;
	}
}
.copy_write{
	margin: 0 auto;
	margin-top: 94rpx;
	width: 92% !important;
	/deep/ .uni-checkbox-input{
		border-radius: 50% !important;
		width: 36rpx;
		height: 36rpx;
		color: #00B359 !important;
		border-color: #00B359;
	}
	/deep/.uni-checkbox-input:hover{
		border-color: #00B359;
	}
	text{
		color: #999999;
		font-size: 26rpx;
	}
	.userAgree{
		color: #00B359;
	}
}
</style>
